﻿<!DOCTYPE html>
<html ng-app="demoApp">
<head>
    <title id="Description">Create a widget from attribute with AngularJS</title>
    <link rel="stylesheet" type="text/css" href="../../jqwidgets/styles/jqx.base.css" />
    <script type="text/javascript" src="../../scripts/angular.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxangular.js"></script>
    <script type="text/javascript" src="../../scripts/demos.js"></script>
    <script type="text/javascript">
        var demoApp = angular.module("demoApp", ["jqwidgets"]);
        demoApp.controller("demoController", function ($scope) {
            $scope.people = [{
                id: 1,
                name: "Nancy",
                age: 52
            }, {
                id: 2,
                name: "Andrew",
                age: 31
            }, {
                id: 3,
                name: "Robert",
                age: 40
            }, {
                id: 4,
                name: "Peter",
                age: 28
            }];

            // init DropDownList's settings object.
            $scope.dropDownListSettings =
            {
                width: 200,
                height: 30,
                autoDropDownHeight: true,
                displayMember: "name",
                valueMember: "id",
                source: $scope.people
            }

            // init selectedValue.
            $scope.selectedValue = $scope.people[0];
        });
    </script>
</head>
<body>
    <div ng-controller="demoController">
         <p><b>Label: </b>{{selectedValue.name}}, <b>Value: </b>{{selectedValue.id}}</p>
        <div jqx-drop-down-list ng-model="selectedValue" jqx-ng-model jqx-settings="dropDownListSettings"></div>
    </div>
</body>
</html>
